package ro.isdc.training.ejb3.course.service.domain;

import javax.xml.bind.annotation.XmlType;

import ro.isdc.training.ejb3.course.domain.Course;
import ro.isdc.training.ejb3.misc.service.domain.ServiceResponse;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Response for the readCourse() service.
 * 
 * @author Andrei Chirila
 */
@XmlType(name="ReadCourseResponseDO")
public class ReadCourseResponse extends ServiceResponse {
  
  /**
   * Generated Serial Version UID
   */
  private static final long serialVersionUID = -8157562607315478391L;
  
  /**
   * The read course.
   */
  private Course course;

  /**
   * @return the course
   */
  public Course getCourse() {
    return course;
  }

  /**
   * @param course the course to set
   */
  public void setCourse(final Course course) {
    this.course = course;
  }

  /**
   * @see java.lang.Object#equals(Object)
   */
  public boolean equals(final Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof ReadCourseResponse)) {
      return false;
    }
    ReadCourseResponse rhs = (ReadCourseResponse) object;
    return new EqualsBuilder().append(this.course, rhs.course).isEquals();
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  public int hashCode() {
    return new HashCodeBuilder(-1261119581, -1579327115).append(this.course)
        .toHashCode();
  }

  /**
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append(
        "course", this.course).toString();
  }
  
}
